package com.ruoyi.web.controller.app;

import com.ruoyi.business.domain.TIncomeLog;
import com.ruoyi.business.service.ITIncomeLogService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * B端 收益接口
 */
@RestController
@RequestMapping("/b-api/income")
public class BapiIncomeController extends BaseController {

    @Autowired
    private ITIncomeLogService incomeLogService;

    /**
     * 获取收益明细列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TIncomeLog incomeLog) {
        // 强制设置当前用户ID，确保数据隔离
        incomeLog.setUserId(SecurityUtils.getUserId());

        startPage();
        List<TIncomeLog> list = incomeLogService.selectTIncomeLogList(incomeLog);
        return getDataTable(list);
    }
}